package com.hncc.sms.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hncc.sms.domain.SmsRegistrationRank;
import com.hncc.sms.service.ISmsRegistrationRankService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;

/**
 * 挂号级别管理Controller
 * 
 * @author ruoyi
 * @date 2020-08-12
 */
@RestController
@RequestMapping("/sms/registration_rank")
@Api(tags = "挂号级别管理接口")
public class SmsRegistrationRankController extends BaseController
{
    @Resource
    private ISmsRegistrationRankService smsRegistrationRankService;

    /**
     * 查询挂号级别管理列表
     */
    @ApiOperation(value = "条件分页查询挂号级别管理",httpMethod = "GET")
    @GetMapping("/list")
    public TableDataInfo list(SmsRegistrationRank smsRegistrationRank)
    {
        startPage();
        List<SmsRegistrationRank> list = smsRegistrationRankService.selectSmsRegistrationRankList(smsRegistrationRank);
        return getDataTable(list);
    }

    /**
     * 导出挂号级别管理列表
     */
    @PreAuthorize("@ss.hasPermi('sms:registration_rank:export')")
    @Log(title = "挂号级别管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SmsRegistrationRank smsRegistrationRank)
    {
        List<SmsRegistrationRank> list = smsRegistrationRankService.selectSmsRegistrationRankList(smsRegistrationRank);
        ExcelUtil<SmsRegistrationRank> util = new ExcelUtil<SmsRegistrationRank>(SmsRegistrationRank.class);
        return util.exportExcel(list, "registration_rank");
    }

    /**
     * 获取挂号级别管理详细信息
     */
    @ApiOperation(value = "根据id获取挂号级别管理详细信息",httpMethod = "GET",
            notes = "根据id查询挂号级别管理")
    @ApiImplicitParam(paramType = "path",name = "id",value = "挂号级别管理id",dataType = "Long",required = true)
    @PreAuthorize("@ss.hasPermi('sms:registration_rank:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(smsRegistrationRankService.selectSmsRegistrationRankById(id));
    }

    /**
     * 新增挂号级别管理
     */
    @ApiOperation(value = "新增",httpMethod = "POST", notes = "新增挂号级别管理")
    @ApiImplicitParam(name = "smsRegistrationRank", value = "新增挂号级别管理", dataType = "SmsRegistrationRank")
    @PreAuthorize("@ss.hasPermi('sms:registration_rank:add')")
    @Log(title = "挂号级别管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SmsRegistrationRank smsRegistrationRank)
    {
        return toAjax(smsRegistrationRankService.insertSmsRegistrationRank(smsRegistrationRank));
    }

    /**
     * 修改挂号级别管理
     */
    @ApiOperation(value = "修改", httpMethod = "PUT", notes = "修改挂号级别管理")
    @ApiImplicitParam(name = "smsRegistrationRank", value = "修改挂号级别管理", dataType = "SmsRegistrationRank")
    @PreAuthorize("@ss.hasPermi('sms:registration_rank:edit')")
    @Log(title = "挂号级别管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SmsRegistrationRank smsRegistrationRank)
    {
        return toAjax(smsRegistrationRankService.updateSmsRegistrationRank(smsRegistrationRank));
    }

    /**
     * 删除挂号级别管理
     */
    @ApiOperation(value = "批量删除", httpMethod = "DELETE", notes = "根据ids删除挂号级别管理")
    @ApiImplicitParam(paramType = "path",name = "ids",value = "挂号级别管理id",dataType = "Long[]",required = true)
    @PreAuthorize("@ss.hasPermi('sms:registration_rank:remove')")
    @Log(title = "挂号级别管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(smsRegistrationRankService.deleteSmsRegistrationRankByIds(ids));
    }
}
